home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
u_man
/
cat1
/
unifdef.z
/
unifdef
Wrap
Text File
|
1998-10-20
|
6KB
|
199 lines
UUUUNNNNIIIIFFFFDDDDEEEEFFFF((((1111)))) UUUUNNNNIIIIFFFFDDDDEEEEFFFF((((1111))))
NNNNAAAAMMMMEEEE
unifdef - strip or reduce ifdefs in C code
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
uuuunnnniiiiffffddddeeeeffff [----DDDD_n_a_m_e]]]] [----DDDD_n_a_m_e=_s_t_r_i_n_g]]]] [----UUUU_n_a_m_e]]]] [----oooo_o_u_t_p_u_t]]]] [----zzzz] [_i_n_p_u_t...]
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
_U_n_i_f_d_e_f reads C source files and prints all input lines except those
excluded by ####iiiiffffddddeeeeffff constructs that refer to specified identifiers.
The ----DDDD option defines _n_a_m_e as a macro with the value 1, causing _u_n_i_f_d_e_f
to simplify
#ifdef _n_a_m_e
_I_n_c_l_u_d_e_d _t_e_x_t
#else
_E_x_c_l_u_d_e_d _t_e_x_t
#endif
to just
_I_n_c_l_u_d_e_d _t_e_x_t
and contrariwise for ####iiiiffffnnnnddddeeeeffff.
The ----UUUU option works like ----DDDD except that _n_a_m_e is undefined, so the ####iiiiffffddddeeeeffff
above would simplify to
_E_x_c_l_u_d_e_d _t_e_x_t
----DDDD_n_a_m_e=_s_t_r_i_n_g causes _u_n_i_f_d_e_f to replace occurrences of _n_a_m_e with _s_t_r_i_n_g
when evaluating ####iiiiffff and ####eeeelllliiiiffff expressions. For example, uuuunnnniiiiffffddddeeeeffff ----DDDDBBBBSSSSDDDD====44443333
would rewrite
#if BSD == 43
_4._3_B_S_D _c_o_d_e
#elif BSD == 42
_4._2_B_S_D _c_o_d_e
#endif
as
_4._3_B_S_D _c_o_d_e
All ####iiiiffffddddeeeeffff constructs that refer to names not defined with ----DDDD or
undefined with ----UUUU are passed unchanged to output. _U_n_i_f_d_e_f simplifies ####iiiiffff
expressions that mix defined or undefined names with unknown names to
PPPPaaaaggggeeee 1111
UUUUNNNNIIIIFFFFDDDDEEEEFFFF((((1111)))) UUUUNNNNIIIIFFFFDDDDEEEEFFFF((((1111))))
express operations on just the unknown names. Thus uuuunnnniiiiffffddddeeeeffff ----DDDDssssggggiiii would
rewrite
#if defined sgi && !defined KERNEL
as
#ifndef KERNEL
and would preserve associated ####eeeellllsssseeee and ####eeeennnnddddiiiiffff sections. _U_n_i_f_d_e_f
simplifies ####eeeelllliiiiffff chains as if they consisted of ####iiiiffff constructs nested
within ####eeeellllsssseeee sections. For example, uuuunnnniiiiffffddddeeeeffff ----DDDDBBBBSSSSDDDD====44443333 would rewrite
#if SYSV
_S_y_s_t_e_m _V _c_o_d_e
#elif BSD == 42
_4._2_B_S_D _c_o_d_e
#elif BSD == 43
_4._3_B_S_D _c_o_d_e
#elif XENIX
_X_e_n_i_x _c_o_d_e
#endif
as
#if SYSV
_S_y_s_t_e_m _V _c_o_d_e
#else
_4._3_B_S_D _c_o_d_e
#if XENIX
_X_e_n_i_x _c_o_d_e
#endif
#endif
_U_n_i_f_d_e_f rewrites ####eeeellllsssseeee and ####eeeennnnddddiiiiffff lines to conform to ANSI C, by
enclosing any tokens after these keywords with comment delimiters. For
example,
#ifdef DEBUG
_D_e_b_u_g_g_i_n_g _c_o_d_e
#endif DEBUG
would be transcribed as
#ifdef DEBUG
_D_e_b_u_g_g_i_n_g _c_o_d_e
#endif /* DEBUG */
PPPPaaaaggggeeee 2222
UUUUNNNNIIIIFFFFDDDDEEEEFFFF((((1111)))) UUUUNNNNIIIIFFFFDDDDEEEEFFFF((((1111))))
_U_n_i_f_d_e_f writes to standard output by default. The ----oooo option may be used
in lieu of shell redirection to specify an output file. More important,
the file specified by _o_u_t_p_u_t may be identical to one of the _i_n_p_u_t files,
or to standard input if there are no arguments. In this case, _u_n_i_f_d_e_f
will safely overwrite the input file.
The ----zzzz option causes _u_n_i_f_d_e_f to simplify or eliminate sections controlled
by ####iiiiffff constructs that test constant integer expressions. By default,
constructs such as
#if 0
_E_x_c_l_u_d_e_d _t_e_x_t
#endif
are left intact.
AAAAUUUUTTTTHHHHOOOORRRR
Brendan Eich, 03/16/89
SSSSEEEEEEEE AAAALLLLSSSSOOOO
cc(1), cpp(1).
PPPPaaaaggggeeee 3333